﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;

public partial class ZhuCe : System.Web.UI.Page
{
    private static string sqlconn = System.Configuration.ConfigurationManager.AppSettings["strConn"].ToString().Trim();
    protected void Page_Load(object sender, EventArgs e)
    {
       // lblMsg.Visible = false;
        txtname.Focus();
    }
    protected void btnZC_Click(object sender, EventArgs e)
    {
        {
            string name = txtname.Text.Trim();
            string id = txtid.Text.Trim();
            string ps = txtpassword.Text.Trim();
            string ph =txtphone.Text.Trim();
            SqlConnection conn = new SqlConnection(sqlconn);
            try
            {
                conn.Open();
                string sql = "insert into parent( p_name,p_id,p_password,p_phone) values('" + name + "','" + id + "','" + ps + "','" + ph + "')";
                SqlCommand comm = new SqlCommand(sql, conn);
                comm.ExecuteNonQuery();
                Response.Write("<script>confirm('恭喜你，注册成功！');window.location.href='DengLu.aspx'</script>");
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                conn.Close();
            }
        }
    }
}